﻿using System;
using System.Collections.Generic;
using System.Linq;
using System.Web;

namespace NutriLeaf.Web.Core.Weight
{
    public class Weight:IWeight
    {
        public Model.WeightCategory GetWeightCategory(int userId, ref Model.NutriLeafDBEntities context)
        {
            return context.UserProfiles.Where(p => p.UserProfileID == userId).First().WeightCategory;
        }

        public float GetCurrentWeight(int userId, ref Model.NutriLeafDBEntities context)
        {
            return (float) context.WeightDiaries.Where(p => p.UserID == userId).First().Weight;
        }

        public void UpdateCurrentWeight(int userId, float currentWeight, ref Model.NutriLeafDBEntities context)
        {
          context.WeightDiaries.Where(p => p.UserID == userId).First().Weight = currentWeight;
          context.SaveChanges();
        }

        public void UpdateWeightCategory(int userId, WeightCategory category, ref Model.NutriLeafDBEntities context)
        {
    
        }

        public void UpdateWeightCategory(int userId, ref Model.NutriLeafDBEntities context)
        {
            throw new NotImplementedException();
        }

        public void InsertWeightIntoDiary(Model.WeightDiary weight, ref Model.NutriLeafDBEntities context)
        {
            throw new NotImplementedException();
        }

        public void InsertWeightIntoDiary(int userId, float weight, DateTime datetime, ref Model.NutriLeafDBEntities context)
        {
            throw new NotImplementedException();
        }

        public void InsertWeightIntoDiary(int userId, float weight, DateTime datetime, WeightCategory category, ref Model.NutriLeafDBEntities context)
        {
            throw new NotImplementedException();
        }

        public Model.WeightDiary GetWeightDiary(int weightDiaryId, ref Model.NutriLeafDBEntities context)
        {
            throw new NotImplementedException();
        }

        public List<Model.WeightDiary> GetWeightDiaries(int userid, DateTime datetimeStart, DateTime datetimeEnd, ref Model.NutriLeafDBEntities context)
        {
            throw new NotImplementedException();
        }

        public Model.WeightDiary GetWeightDiary(int userId, DateTime dateTime, ref Model.NutriLeafDBEntities context)
        {
            throw new NotImplementedException();
        }

        public Model.WeightDiary GetRecentWeightDiary(int userid, ref Model.NutriLeafDBEntities context)
        {
            throw new NotImplementedException();
        }

        public void UpdateWeightDiary(Model.WeightDiary weight, ref Model.NutriLeafDBEntities context)
        {
            throw new NotImplementedException();
        }

        public void RemoveWeightDiary(Model.WeightDiary weight, ref Model.NutriLeafDBEntities context)
        {
            throw new NotImplementedException();
        }

        public void RemoveWeightDiary(int weightDiaryId, ref Model.NutriLeafDBEntities context)
        {
            throw new NotImplementedException();
        }
    }
}